<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">  
 
    <h:head>
		<title>Cadastro de Contextos</title>
    </h:head>
    <link type="text/css" href="css/custom-theme/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
    <link rel="stylesheet" href="css/style.css" type="text/css"/>
    <script type="text/javascript" src="scripts/easypaginate.js"></script>
    <script type="text/javascript" src="scripts/help.js"></script>
	<style type="text/css">  
    	.ui-widget {  
        	font-size: 12px !important;  
    	} 
    	.ui-layout-west {  
		    z-index:20 !important;  
		    overflow:visible;
 
		}  

	</style>
      
<h:body style="background-color: #ffffff">  
	<h:form id="contexto" prependId="false">       
	<p:growl id="messages" showDetail="true" stick="true"/>
    <p:dataTable id="contextos" var="contexto" value="#{contextoMB.contextos}" rowKey="#{contexto.id}"  
                 selection="#{contextoMB.contexto}" selectionMode="single" paginator="true" rows="5"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15">  
  
        <f:facet name="header">  
            Selecione um Contexto para editar ou click em NOVO
        </f:facet>  
  	
  		<p:column headerText="Unidade Principal">  
            #{contexto.unidade.chave}  
        </p:column>
        <p:column headerText="Tipo">  
            #{contexto.unidade.tipo.descricao}  
        </p:column>  
         <p:column headerText="Dependencias">  
             <ui:repeat value="#{contexto.dependencias}" var="item" varStatus="status">
				   <h:outputText value="#{item.chave}" />

			   		<h:outputText value=" - " rendered="#{!status.last}" />

			</ui:repeat>  
        </p:column>  
    
        <f:facet name="footer">  
			<p:commandButton value="Editar" action="#{contextoMB.editar}" ajax="false" update="cadContexto" />
			<p:commandButton value="Novo" action="#{contextoMB.novo}" ajax="false" /> 
        </f:facet>  

    </p:dataTable>

	</h:form>
	<p:panel id="painelCadContexto" rendered="#{contextoMB.cadContexto}">
		<ui:include src="CadContexto.xhtml"/> 	
	</p:panel>
    
</h:body>  
</html> 